package cn.iocoder.yudao.module.infra.service.face;

import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.infra.dal.dataobject.face.FaceLogDO;
import cn.iocoder.yudao.module.infra.dal.mysql.face.FaceLogMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;

/**
 * 人脸验证日志 Service 实现类
 *
 * @author 芋道源码
 */
@Service
@Validated
@Slf4j
public class FaceLogServiceImpl implements FaceLogService {

    @Resource
    private FaceLogMapper faceLogMapper;

    @Override
    public Long createLog(FaceLogDO faceLog) {
        faceLogMapper.insert(faceLog);
        return faceLog.getId();
    }

    @Override
    public PageResult<FaceLogDO> getLogPage(Integer pageNo, Integer pageSize, Long userId, String operationType, Boolean success) {
        PageParam pageParam = new PageParam();
        pageParam.setPageNo(pageNo);
        pageParam.setPageSize(pageSize);
        return faceLogMapper.selectPage(pageParam, userId, operationType, success, null, null);
    }

    @Override
    public FaceLogDO getLog(Long id) {
        return faceLogMapper.selectById(id);
    }

}